SRCS := main.c \
    	queue_test.c \
		darray_test.c \
		buffer_test.c \
		mem_pool_test.c \
		pthread_locker_test.c \
		stack_test.c \
		task_test.c \
		work_queue_test.c \
		worker_pool_test.c

OBJS := $(SRCS:.c=.o)

TARGET := cutils_test echo_test log_test

#CFLAGS += -g -Wall -DDEBUG -O2 -I../inc 
#LDFLAGS += -L../build/lib -lcutils -lpthread
CFLAGS += -g -Wall -DDEBUG -I/usr/local/include/cutils 
LDFLAGS += -L/usr/local/lib -lcutils -lpthread
all : $(TARGET)
	@echo "compile all done"
	@echo "please run cutils_test, echo_test, log_test to test libcutils"

cutils_test : $(OBJS)
	$(CC) -o $@ $^ $(LDFLAGS)

echo_test: echo_serv echo_client
	@echo "compile $@ done"

log_test: log_serv log_client
	@echo "compile $@ done"

echo_serv : echo_serv.o
	$(CC) -o $@ $^ $(LDFLAGS)

echo_client: echo_client.o
	$(CC) -o $@ $^ $(LDFLAGS)

log_serv: log_serv.o
	$(CC) -o $@ $^ $(LDFLAGS)

log_client: log_client.o
	$(CC) -o $@ $^ $(LDFLAGS)

%.o : %.c
	$(CC) -c $^ $(CFLAGS)

.phony : all clean

clean:
	rm -rf *.o $(TARGET) echo_serv echo_client log_serv log_client
